package com.myblog.controllers;

import com.myblog.mappers.BlogMapper;
import com.myblog.models.Blog;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class BlogController {

    @Resource
    private BlogMapper blogMapper;

    @GetMapping("/blogs")
    public String test(Model model) {
        List blogList = blogMapper.selectList(null);
        model.addAttribute("blogs", blogList);
        return "blogs";
    }

}